#!/bin/sh /usr/share/dpatch/dpatch-run
Description: drop DGA support, fixing SDL_VIDEODRIVER parsing issues
Author: Hans de Goede <hdegoede@redhat.com>
Last-Update: 2011-12-13

Index: njam-1.25/src/njam.cpp
===================================================================
--- njam-1.25.orig/src/njam.cpp	2012-07-04 16:46:32.000000000 +0000
+++ njam-1.25/src/njam.cpp	2012-07-04 16:49:29.000000000 +0000
@@ -52,7 +52,6 @@
 {
  	bool Fullscreen = true;
  	bool SWSurface = true;
-	bool UseDGA = false;
  	if (argc > 1)
  	{
  		for (int i=1; i<argc; i++)
@@ -64,8 +63,6 @@
 					Fullscreen = false;	// use njam.exe -w windowed mode
 				else if (argv[i][1] == 'h')
 					SWSurface = false;	// use -h for hardware surfaces
-				else if (argv[i][1] == 'd')
-					UseDGA = true;
 				else
 					ok = false;
 			}
@@ -77,7 +74,6 @@
 				printf("Usage:  njam -[w|d|h]\n\n");
 				printf("-w  start in Windowed mode (as opposed to fullscreen).\n");;
 				printf("-h  use Hardware surfaces (faster, doesn't work well with all graphic cards).\n");
-				printf("-d  use DGA driver on Linux, (much faster, but must run as root).\n");
 				return 1;
 			}
 		}
@@ -106,7 +102,7 @@
 #endif
 
 	NjamEngine Engine;
-	if (!Engine.Init(Fullscreen, SWSurface, UseDGA))
+	if (!Engine.Init(Fullscreen, SWSurface))
 	{
 		LogFile("Failed.\n");
 		return 1;
@@ -159,12 +155,6 @@
 //-----------------------------------------------------------------------------
 NjamEngine::~NjamEngine()
 {
-#ifdef __linux__
-	char bufsdl[30];
-	sprintf(bufsdl, "SDL_VIDEODRIVER=%s", linux_sdl_driver);
-	putenv(bufsdl);
-#endif
-
  	if (script_file)
 		fclose(script_file);
 
@@ -333,24 +323,8 @@
     }
 }
 //-----------------------------------------------------------------------------
-bool NjamEngine::Init(bool Fullscreen, bool SoftwareSurface, bool UseDGA)
+bool NjamEngine::Init(bool Fullscreen, bool SoftwareSurface)
 {
-#ifdef __linux__
-	sprintf(linux_sdl_driver, "x11\0");
-	char *driver_name = getenv("SDL_VIDEODRIVER");
-	if (driver_name)
-		sprintf(linux_sdl_driver, "%s\0", driver_name);
-
-	if (UseDGA)
-	{
-		printf("You must be root to run DGA\nType ./njam -? for help\n");
-		putenv("SDL_VIDEODRIVER=dga");
-	}
-#else
-	if (UseDGA)
-		printf("Parameter -d is ignored for non-Linux platforms.\n");
-#endif
-
  	LogFile("Initializing SDL: VIDEO & AUDIO...", true);
 	if ( SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO|SDL_INIT_TIMER ) < 0 )
 	{
Index: njam-1.25/src/njam.h
===================================================================
--- njam-1.25.orig/src/njam.h	2005-12-13 11:56:43.000000000 +0000
+++ njam-1.25/src/njam.h	2012-07-04 16:50:13.000000000 +0000
@@ -111,7 +111,6 @@
 
  	bool m_SDL;						// whether SDL is initialized or not
 	bool m_AudioAvailable;			// so we know wheter to try to play music/sfx
-	char linux_sdl_driver[10];
 	SDL_Surface *m_Screen;
 
 	tGameOptions m_GameOptions;
@@ -201,7 +200,7 @@
 public:
 	NjamEngine();
 	~NjamEngine();
-	bool Init(bool,bool,bool);				// initialize everything except for networking
+	bool Init(bool,bool);				// initialize everything except for networking
 	void Start();					// start the music and main menu loop
 };
 //-----------------------------------------------------------------------------
